package com.srxz.mobilepharmacy.entity.view;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

/**
 * @ClassName: VwMrStk
 * @author: wgchao
 * @createTime: 2018/12/29 10:11 AM
 * @Description: 药物库存
 */
@Entity
@Table(name = "vw_mr_stk")
@AllArgsConstructor
@NoArgsConstructor
@Data
public class VwMrStk implements Serializable {
    @Id
    private Integer id;

    @Column(name = "aid")
    private BigInteger aid;
    @Column(name = "mrn")
    private Integer mrn;
    @Column(name = "ad")
    private Integer ad;
    @Column(name = "edt")
    private Date edt;
    @Column(name = "mid")
    private Integer mid;
    @Column(name = "gn")
    private String gn;
    @Column(name = "wn")
    private String wn;
    @Column(name = "made")
    private String made;
    @Column(name = "spr")
    private String spr;
    @Column(name = "sps")
    private String sps;
    @Column(name = "utr")
    private String utr;
    @Column(name = "uts")
    private String uts;
    @Column(name = "utfac")
    private Double utfac;
    @Column(name = "bn")
    private String bn;
    @Column(name = "vdate")
    private Integer vdate;
    @Column(name = "quan")
    private Double quan;
    @Column(name = "pri")
    private Double pri;
    @Column(name = "prr")
    private Double prr;
    @Column(name = "idate")
    private Integer idate;
    @Column(name = "adfn")
    private Integer adfn;
    @Column(name = "dpra")
    private Double dpra;
    @Column(name = "dprr")
    private Double dprr;
    @Column(name = "dprt")
    private Double dprt;
    @Column(name = "dprm")
    private Double dprm;
    @Column(name = "base")
    private Integer base;
    @Column(name = "base_cl")
    private Integer base_cl;
    @Column(name = "sk")
    private String sk;
    @Column(name = "sty")
    private String sty;
    @Column(name = "bus")
    private String bus;
    @Column(name = "rtm")
    private String rtm;
    @Column(name = "afn")
    private String afn;
    @Column(name = "cond")
    private String cond;
    @Column(name = "spec")
    private Integer spec;
    @Column(name = "mid_cl")
    private String midcl;

    @Transient
    private Double realquan;
    @Transient
    private Double stksum;

    public VwMrStk(BigInteger aid, Integer mrn, Integer ad, Date edt, Integer mid,
                   String gn, String wn, String made, String spr, String sps,
                   String utr, String uts, Double utfac, String bn, Integer vdate,
                   Double quan, Double pri, Double prr, Integer idate, Integer adfn,
                   Double dpra, Double dprr, Double dprt, Double dprm, Integer base,
                   Integer base_cl, String sk, String sty, String bus, String rtm,
                   String afn, String cond, Integer spec) {
        this.aid = aid;
        this.mrn = mrn;
        this.ad = ad;
        this.edt = edt;
        this.mid = mid;
        this.gn = gn;
        this.wn = wn;
        this.made = made;
        this.spr = spr;
        this.sps = sps;
        this.utr = utr;
        this.uts = uts;
        this.utfac = utfac;
        this.bn = bn;
        this.vdate = vdate;
        this.quan = quan;
        this.pri = pri;
        this.prr = prr;
        this.idate = idate;
        this.adfn = adfn;
        this.dpra = dpra;
        this.dprr = dprr;
        this.dprt = dprt;
        this.dprm = dprm;
        this.base = base;
        this.base_cl = base_cl;
        this.sk = sk;
        this.sty = sty;
        this.bus = bus;
        this.rtm = rtm;
        this.afn = afn;
        this.cond = cond;
        this.spec = spec;
        this.realquan = quan;
    }

    public VwMrStk(BigInteger aid, Integer mid, String gn, String wn, String made, String spr,
                   String utr, Double quan) {
        this.aid = aid;
        this.mid = mid;
        this.gn = gn;
        this.wn = wn;
        this.made = made;
        this.spr = spr;
        this.utr = utr;
        this.quan = quan;
    }

    public VwMrStk(BigInteger aid, Integer mid, String gn, String wn, String made, String spr,
                   String utr) {
        this.aid = aid;
        this.mid = mid;
        this.gn = gn;
        this.wn = wn;
        this.made = made;
        this.spr = spr;
        this.utr = utr;
    }

    public VwMrStk(Object[] objs) {
        this.aid = objs[0]==null?null:new BigInteger(objs[0].toString());
        this.mid = objs[1]==null?null:new Integer(objs[1].toString());
        this.gn = objs[2]==null?null:objs[2].toString();
        this.wn = objs[3]==null?null:objs[3].toString();
        this.made = objs[4]==null?null:objs[4].toString();
        this.spr = objs[5]==null?null:objs[5].toString();
        this.utr = objs[6]==null?null:objs[6].toString();
        this.midcl = objs[7]==null?null:objs[7].toString();
        this.stksum = objs[8]==null?null:Double.valueOf(objs[8].toString());
    }


}
